<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.qiqianyi.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 晓乐 <wxl@yuzixing.com>
// +----------------------------------------------------------------------
namespace app\company\model;

use think\Model;


class MemberBabyModel extends Model
{
    protected $type = [
        'more' => 'array',
    ];



    public function addBaby($data)
    {

        if (!empty($data['more']['thumbnail'])) {
            $data['more']['thumbnail'] = cmf_asset_relative_url($data['more']['thumbnail']);
            $data['thumbnail']         = $data['more']['thumbnail'];
        }


        $data['create_time'] = time();
        $data['update_time'] = time();

         $this->allowField(true)->data($data, true)->isUpdate(false)->save();


        return $this;

    }


    public function editBaby($data)
    {

        if (!empty($data['more']['thumbnail'])) {
            $data['more']['thumbnail'] = cmf_asset_relative_url($data['more']['thumbnail']);
            $data['thumbnail']         = $data['more']['thumbnail'];
        }


        $data['update_time'] = time();

       $this->allowField(true)->data($data, true)->isUpdate(true)->save();
        return $this;

    }



}